package com.yeyks.common.appcommon.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author: gui
 * @date: 2019/5/20 0020 10:36
 */
@Data
@ApiModel(description = "路由对象属性")
public class AppRouteDTO implements Serializable {
    private static final long serialVersionUID = -8214550320228647750L;

    @ApiModelProperty("路由ID")
    @JsonIgnore
    private Long routeId;

    @ApiModelProperty("路由的名称")
    private String routeName;

    @ApiModelProperty("路由的路径")
    private String routeUrl;

    @ApiModelProperty("路由父类ID")
    @JsonIgnore
    private Long routeParentId;

    @ApiModelProperty("路由的图片")
    private String routeImg;

    @ApiModelProperty("路由的排序")
    private Integer routeSort;

    @ApiModelProperty("子路由")
    private List<AppRouteDTO> routeList = Lists.newArrayList();

    /**
     * 添加属性
     * @param route 路由对象
     */
    public void setEntity(AppRouteDTO route){
        setRouteImg(route.getRouteImg());
        setRouteParentId(route.getRouteParentId());
        setRouteId(route.getRouteId());
        setRouteSort(route.getRouteSort());
        setRouteName(route.getRouteName());
        setRouteUrl(route.getRouteUrl());
    }

    /**
     * 添加子类
     * @param route 路由对象
     */
    public void addChildren(AppRouteDTO route){
        this.routeList.add(route);
    }
}
